<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../fontawesome/css/all.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }

        body {
            background: #444444;
            font-family: 'Open Sans', Arial, Helvetica, Sans-serif, Verdana, Tahoma;
        }

        ul {
            list-style-type: none;
        }

        a {
            color: #b63b4d;
            text-decoration: none;
        }

        h1 {
            color: #fff;
            font-size: 24px;
            font-weight: 400;
            text-align: center;
            margin-top: 80px;
        }

        h1 a {
            color: #c12c42;
            font-size: 16px;
        }

        .accordion {
            width: 100%;
            max-width: 360px;
            margin: 3px auto 20px;
            background: #f5f1f1;
            -webkit-border-radius: 0;
            -moz-border-radius: 0;
            border-radius: 0;
        }

        .accordion .link {
            cursor: pointer;
            display: block;
            padding: 15px 15px 15px 42px;
            color: #4d4d4d;
            font-size: 14px;
            font-weight: 700;
            border-bottom: 1px solid #ccc;
            position: relative;
            -webkit-transition: all 0.4s ease;
            -o-transition: all 0.4s ease;
            transition: all 0.4s ease;
        }

        .accordion li:last-child .link {
            border-bottom: 0;
        }

        .accordion li i {
            position: absolute;
            top: 16px;
            left: 12px;
            font-size: 18px;
            color: #595959;
            -webkit-transition: all 0.4s ease;
            -o-transition: all 0.4s ease;
            transition: all 0.4s ease;
        }

        .accordion li i.fa-chevron-down {
            right: 12px;
            left: auto;
            font-size: 16px;
        }

        .accordion li.open .link {
            color: #b63b4d;
        }

        .accordion li.open i {
            color: #b63b4d;
        }

        .accordion li.open i.fa-chevron-down {
            -webkit-transform: rotate(180deg);
            -ms-transform: rotate(180deg);
            -o-transform: rotate(180deg);
            transform: rotate(180deg);
        }

        .submenu {
            display: none;
            background: #444359;
            font-size: 14px;
        }

        .submenu li {
            border-bottom: 1px solid #4b4a5e;
        }

        .submenu a {
            display: block;
            text-decoration: none;
            color: #d9d9d9;
            padding: 12px;
            padding-left: 42px;
            -webkit-transition: all 0.25s ease;
            -o-transition: all 0.25s ease;
            transition: all 0.25s ease;
        }

        .submenu a:hover {
            background: #b63b4d;
            color: #fff;
        }

        .title {
            background-color: #a1a29c;
            line-height: 40px;
            margin-bottom: 8px;
            text-align: center;
            color: #444444;
            font-family: 幼圆;
        }
    </style>
</head>

<body>
<h3 class="title">菜单管理</h3>
<ul id="accordion" class="accordion">

</ul>
<script src="../static/js/jquery-3.6.0.min.js"></script>
<script>
    $(function () {
        // 根据角色，显示不一样的菜单
        let role = sessionStorage.getItem("role");
        console.log("-------------------", role);
        if (role == 0) {// 管理员
            $(`
            <li>
    <div class="link"><i class="fa fa-keyboard"></i>电信学院<i class="fa fa-chevron-down"></i>
    </div>
    <ul class="submenu">
        <li><a href="http://localhost:8080/welcome/student?institute=1" target="card">学生列表</a>
        </li>
        <li><a href="http://localhost:8080/welcome/adduser.html" target="card">添加学生</a>
        </li>
    </ul>
</li>
<li>
    <div class="link"><i class="fa fa-graduation-cap"></i>会计学院<i class="fa fa-chevron-down"></i>
    </div>
    <ul class="submenu">
        <li><a href="http://localhost:8080/welcome/student?institute=2" target="card">学生列表</a>
        </li>
        <li><a href="http://localhost:8080/welcome/adduser.html" target="card">添加学生</a>
        </li>
    </ul>
</li>
<li>
    <div class="link"><i class="fa fa-mobile"></i>经贸学院<i class="fa fa-chevron-down"></i>
    </div>
    <ul class="submenu">
        <li><a href="http://localhost:8080/welcome/student?institute=3" target="card">学生列表</a>
        </li>
        <li><a href="http://localhost:8080/welcome/adduser.html" target="card">添加学生</a>
        </li>
    </ul>
</li>
<li>
    <div class="link"><i class="fa fa-feather-alt"></i>个人中心<i class="fa fa-chevron-down"></i>
    </div>
    <ul class="submenu">
        <li><a href="http://localhost:8080/welcome/username.html" target="card">修改密码</a>
        </li>
    </ul>
</li>
                    `).appendTo($("#accordion"))

        } else if (role == 1) {// 学生
            $(`
                    <li>
                         <div class="link"><i class="fa fa-school"></i>学院概况<i class="fa fa-chevron-down"></i>
                         </div>
                         <ul class="submenu">

                           <li><a href="../text.html" target="card">学院简介</a></li>
                         </ul>
                    </li>
                    <li>
                         <div class="link"><i class="fa fa-mobile"></i>信息服务<i class="fa fa-chevron-down"></i>
                         </div>
                         <ul class="submenu">
                           <li><a href="../phone.html" target="card">联系方式</a></li>
                         </ul>
                     </li>
                     <li>
    <div class="link"><i class="fa fa-feather-alt"></i>个人中心<i class="fa fa-chevron-down"></i>
    </div>
    <ul class="submenu">
        <li><a href="http://localhost:8080/welcome/username.html" target="card">修改密码</a>
        </li>
    </ul>
</li>
                    `).appendTo($("#accordion"))
        }
    })
</script>
<script src="js/index.js"></script>
</body>

</html>